package com.stone.design.mode.strategy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller("/test")
public class TestController {

    @Autowired
    StrategyTestService strategyTestService;

    @GetMapping("/strategy")
    public void test() {
        // A策略
        strategyTestService.testStrategy("ONE");
        // B策略
        strategyTestService.testStrategy("TWO");
        // C策略，容器中不存在该编码对应的策略，抛出异常
        strategyTestService.testStrategy("THREE");
    }

}